<?php
declare(strict_types=1);

namespace WebApp\lib\app;

/**
 * Class SwooleApp
 * @package WebApp\lib\app
 */
class SwooleApp extends AbstractApp
{
    /**
     * AbstractApp constructor.
     * @param $request
     * @param $response
     */
    public function __construct(&$request = null, &$response = null)
    {
        parent::__construct($request, $response);
        unset($request);
        unset($response);
    }

    /**
     * @return AbstractApp
     */
    public function check(): AbstractApp
    {
//        $origin = isset($_SERVER['HTTP_ORIGIN'])? $_SERVER['HTTP_ORIGIN'] : '';
//        $allow_origin = array(
//            'http://www.client.com',
//            'http://www.client2.com'
//        );
//        if(in_array($origin, $allow_origin)){
//            header('Access-Control-Allow-Origin:'.$origin);
//            header('Access-Control-Allow-Methods:POST');
//            header('Access-Control-Allow-Headers:x-requested-with,content-type');
//        }
//        $this->getResponse()->header('Access-Control-Allow-Origin', 'http://123.207.243.228/api');
//        $this->getResponse()->header('Access-Control-Allow-Origin', '*');
//        $this->sessionStart();
        return $this;
    }

//    private function isApi()
//    {
//        return ($this->getRequest()->server['request_uri'] === '/api/') ? true : false;
//    }
}